/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jollylengkono.skripsi.CollaborativeWorksComment.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jollylengkono.skripsi.dao.CollaborativeWorksCommentDao;
import jollylengkono.skripsi.model.CollaborativeWorksComment;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * @author hp02
 */
public class CollaborativeWorksCommentRead extends Action {

    private String FORWARD;
    
    public CollaborativeWorksCommentRead() {
    }

    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form, 
            HttpServletRequest request, HttpServletResponse response) {
        long id = Long.parseLong(request.getParameter("cwc_id"));
        CollaborativeWorksComment comment = (CollaborativeWorksComment) 
                new CollaborativeWorksCommentDao().read(id);
        if(comment==null) {
            FORWARD = "fail";
        } else {
            FORWARD = "success";
            request.setAttribute("comment", comment);
        }
        return mapping.findForward(FORWARD);
    }

}
